home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Windows Expert
/
Windows Expert.iso
/
windownt
/
perlnt.zip
/
t
/
comp
/
opts.nt
< prev
next >
Wrap
Text File
|
1993-07-25
|
1KB
|
53 lines
print "1..5\n";
#
# test -a command line option
#
$x = `echo 1 2 3 4 5 | perl -nae 'print ((\$F[4] == 5) ? "ok": "not ok");'`;
print $x, " 1\n";
#
# test the -l (line end processing) option
#
$x = `perl -l014 -e 'print "ok" if (\$\\ eq "\014");'`;
chop $x;
if ("$x" eq "ok") {print "ok 2\n";} else {print "not ok 2\n";}
#
# test the -0 (record terminator) option
#
$x = `echo 1 2 3 4 | perl -0040 -l012 -ne 'print;'`;
@x = $x ne '' ? split ('\n', $x) : ();
if (@x == 4 && $x[0] eq "1") {print "ok 3\n";} else {print "not ok 3\n";}
#
# test the -w option
#
open (T, ">foo$$") || die "Can't open foo$$ for writing: $!\n";
print T 'print "$^W";';
close T;
$x = `perl -w foo$$`;
unlink foo$$;
if ($x eq "1") {print "ok 4\n";} else {print "not ok 4 ($x)\n";}
open (T, ">foo$$") || die "Can't open foo$$ for writing: $!\n";
print T '$c = 1;';
close T;
$x = `perl -w foo$$ 2>&1`;
if ($x =~ /^Possible typo/) {print "ok 5\n";} else {print "not ok 5\n";}
unlink foo$$;
#
# test the -s command line option
#